package com.example.ad;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * TopicConsumerListener
 *
 * @author wangrui
 * @date 2022/1/25 10:49
 */
@Component
public class ConsumerListener {
    @JmsListener(destination = "${spring.activemq.topic-name}", containerFactory = "topicListener")
    public void readActiveTopic(String msg) {
        System.out.println("收到topic消息：" + msg);
    }

    @JmsListener(destination = "${spring.activemq.queue-name}", containerFactory = "queueListener")
    public void readActiveQueue(String msg) {
        System.out.println("收到queue消息：" + msg);
    }
}
